package cn.itcast.user.contriller;

import cn.itcast.hmall.pojo.user.Address;
import cn.itcast.hmall.pojo.user.User;
import cn.itcast.user.servicer.servicerUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/address")
public class UserContrller {
    @Autowired
    servicerUser servicerUsers;


    @GetMapping("/uid")
    public List<Address> selectAddresss() {
        return servicerUsers.idServiceS();
    }

    @GetMapping("/{addressId}")
    public Address selectAddress(@PathVariable("addressId") String id) {
        return servicerUsers.idService(id);
    }

    @PostMapping("/user")
    public User userselect(@RequestParam  Long id) {
        User byId = servicerUsers.getById(id);
        return byId;
    }
    @PostMapping("/user/je")
    public int updateUserById(@RequestBody User user) {
       return servicerUsers.updateById(user);

    }
}
